import wepy from 'wepy'
import http from '../utils/request'
export default class testMixin extends wepy.mixin {
  data = {
    systemInfo: wx.getStorageSync('systemInfo')
  }
  methods = {
    jumpTo (url, methods) {
      // 如果加了导航标签，会导致样式乱了，所以加此方法
      wx[methods]({
        url: url
      })
    },
    async sendFormId (e) {
      // 收集formId
      console.log(e.detail.formId)
      if (e.detail.formId === 'the formId is a mock one' ) {  // 判断是否在调试工具里面
        return false
      }
      let { data } = await http({
        url: 'wechatMiniFormId/save',
        data: {
          formId: e.detail.formId
        }
      })
      console.log('form', data)
    }
  }

  onShow() {}

  onLoad() {}

  onUnload () {
    // const data = this.data
    // for (let key in data) {
    //   this[key] = null
    // }
    // this.$apply()
  }
}
